<?php

namespace App\Models;

use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Model;

class DeviceInfo extends Model
{
    protected $table = 'saturn_device_info';

    //修改
    public function editArray($where, $arr){
        return DB::table($this->table)->where($where)->update($arr);
    }

     //查询所有
    public function getAll($where='',$select=''){
        $model=DB::table($this->table);
        if(!empty($select)) $model->select($select);
        if(!empty($where)) $model->where($where);
        return json_decode(json_encode($model->get()), true);
        //$arr=$model->get();
        //return $model->get()->toArray();
        //return array_map('get_object_vars', $arr);
    }

    //修改 主机状态
    public function editHostArray($where, $arr){
        return DB::table('saturn_host_info')->where($where)->update($arr);
    }

}